---
# tasks file for install bitrix24 in CentOS 

- name: Install for centos | Update apt cache
  become: true
  ansible.builtin.yum: 
    update_cache: yes 
#  ignore_errors: true

- name: Install for centos | Download bitrix24 install file
  ansible.builtin.get_url:
    url: " {{ bitrix_env_url }}"
    dest: "{{ dest_folder }}"
    mode: '0755'

- name: Install for centos | Aditional partirion for bitrix
  include_tasks: mount_part.yml

- name: Install for centos | Disable SElinux
  become: true
  ansible.builtin.lineinfile:
    path: /etc/selinux/config
    regexp: '^SELINUX='
    line: SELINUX=disabled
    create: yes
  notify: Reboot host

- name: Install for centos | Flush handlers
  ansible.builtin.meta: flush_handlers

- name: Install for centos | Wait for the machine to come back online
  ansible.builtin.wait_for_connection:
    connect_timeout: 60
    sleep: 5
    delay: 5
    timeout: 300

- name: Install for centos | Register info about mount's
  ansible.builtin.command: df -h
  register: mount_info

- name: Install for centos | View info about mount's
  debug: 
    var: mount_info.stdout_lines

- name: Install for centos | Start install file
  become: true
  ansible.builtin.command: ./{{ dist_file }} -s -p -H '{{ server_name }}' -F -m '{{ mysql_ver }}' -M "{{ mysql_root_password }}"
  register: result_install_bitrix

- name: Install for centos | Show result install
  debug:
    var: result_install_bitrix